﻿<%@ Page Title="" Language="C#" MasterPageFile="~/master/admin.master" AutoEventWireup="true"
    CodeFile="inqueries.aspx.cs" Inherits="admin_inqueries" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register Namespace="ECommerce.Library.Web" TagPrefix="ucc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="AdminHeaderContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphMiddleContent" runat="Server">
    <script type="text/javascript">
    var categoryGrid;
     var winDetails;
     
    var onDocumentReady = function (grid,winDet) {
        categoryGrid = grid;
         winDetails = winDet;
    }


     function ShowDetails(_txt) {
     
         winDetails.show();
              <%= txtMessage.ClientID %>.setText(_txt);
            
        }
     var Inquiry_Renderer = function (value, p, record, rowIndex) {
     
                if(record.data.Inquiry!=null && record.data.Inquiry!="")
                {
                var _txt=record.data.Inquiry.toString().replace(/\s+/g, " ").replace(/[^\w\s]/gi, '');
                //alert(_txt);
               return "<a class=\"leftlink\" onclick=\"ShowDetails('"+_txt+"');return false;\" href='#' ><img src='../App_Style/images/ico-email-a-friend.png' /></a>";
               }
               else{
               return "";
               }
        }
    </script>
    <ext:ResourceManager ID="ScriptManager1" runat="server" Theme="Gray">
        <Listeners>
            <DocumentReady Fn="onDocumentReady(#{GridPanel1},#{winDetails})" />
        </Listeners>
    </ext:ResourceManager>
    <ext:Store ID="Store1" runat="server" RemoteSort="true" OnRefreshData="Store1_RefreshData">
        <AutoLoadParams>
            <ext:Parameter Name="sort" Value="InquiryId" Mode="Value" />
            <ext:Parameter Name="start" Value="0" Mode="Raw" />
            <ext:Parameter Name="limit" Value="50" Mode="Raw" />
        </AutoLoadParams>
        <Proxy>
            <ext:PageProxy />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="InquiryId">
                <Fields>
                    <ext:RecordField Name="InquiryId" />
                    <ext:RecordField Name="Name" Type="String" />
                    <ext:RecordField Name="Organization" Type="String" />
                    <ext:RecordField Name="Telephone" Type="String" />
                    <ext:RecordField Name="EmailAddress" Type="String" />
                    <ext:RecordField Name="Subject" Type="String" />
                    <ext:RecordField Name="Inquiry" Type="String" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <div class="admin-function-top inline">
        <ucc:ResponseMessage ID="uccResponseMessage" runat="server"></ucc:ResponseMessage>
        <ext:GridPanel ID="GridPanel1" runat="server" EnableViewState="true" AutoHeight="true"
            StoreID="Store1">
            <ColumnModel>
                <Columns>
                    <ext:Column Header="Name" Width="80" DataIndex="Name">
                    </ext:Column>
                    <ext:Column Header="Email" Width="60" DataIndex="EmailAddress">
                    </ext:Column>
                    <ext:Column Header="Organization" Width="50" DataIndex="Organization" Sortable="false">
                    </ext:Column>
                    <ext:Column Header="Telephone" Width="20" DataIndex="Telephone" Sortable="false">
                    </ext:Column>
                    <ext:Column Header="Subject" Width="20" DataIndex="Subject" Sortable="false">
                    </ext:Column>
                    <ext:Column Header="" Width="20" DataIndex="Inquiry">
                        <Renderer Fn="Inquiry_Renderer" />
                    </ext:Column>
                </Columns>
            </ColumnModel>
            <BottomBar>
                <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="50" DisplayInfo="true"
                    DisplayMsg="Displaying customers {0} - {1} of {2}" EmptyMsg="No customers to display"
                    AutoWidth="true" />
            </BottomBar>
       
            <View>
                <ext:GridView ID="GridView1" runat="server" ForceFit="true" />
            </View>
        </ext:GridPanel>
        <ext:Window ID="winDetails" runat="server" Width="400" Height="200" Modal="true"
            Hidden="true" Layout="Fit">
            <Items>
                <ext:TabPanel ID="TabPanel1" runat="server" Border="false">
                    <Items>
                        <ext:Panel ID="PersonalInfoTab" runat="server" Title="Inquery" Padding="5"
                            Layout="Form">
                            <Items>
                                <ext:Label ID="txtMessage" runat="server" FieldLabel="Inquery Text" />
                            </Items>
                        </ext:Panel>
                    </Items>
                </ext:TabPanel>
            </Items>
            <Buttons>
                <ext:Button ID="CancelButton" runat="server" Text="Ok" Icon="Accept">
                    <Listeners>
                        <Click Handler="#{winDetails}.hide(null);" />
                    </Listeners>
                </ext:Button>
            </Buttons>
        </ext:Window>
    </div>
    <script type="text/javascript">
        Ext.override(Ext.grid.GridView, {
            getEditorParent: function () {
                return document.body;
            }
        });
    </script>
</asp:Content>
